/* Let f(n) be the number of paths whose starting point and ending point have
 * distance 'n' on the diagonal and whose interim is allowed to touch the 
 * diagonal line. 
 *
 * Let g(n) be the number of paths whose starting point and ending point have 
 * distance 'n' on the diagonal but whose interim is NOT allowed to touch the 
 * diagonal line.
 * 
 * Then we have the following recurrence relations:
 *
 *     f(1) = 1,
 *     g(1) = 1,
 *     f(n) = g(n) + g(n-1)*f(1) + ... + g(2)*f(n-2) + g(1)*f(n-1),
 *     g(n) = f(n-1).
 *
 * If we define f(0) = 1, then we can write the third equation as
 *
 *     f(n) = f(n-1)*f(0) + f(n-2)*f(1) + ... + f(1)*f(n-2) + f(0)*f(n-1).
 *
 * In addition, the terms in the summation are in decreasing order of ranks.
 * We can use this recurrence relation to compute all f(n)'s. We also note 
 * that f(19) is the biggest term that can be represented by a 32-bit integer.
 */

#include <stdio.h>
#include <algorithm>

#define MAX_N   20

static int f[MAX_N];            /* f[n] = defined above */
static int fsum[MAX_N][MAX_N];  /* f[n][k] = partial sum of the first (k+1)
                                 *           terms in f[n]. */

static char *concat_path(char *s, int n, int m)
{
#if _DEBUG
    printf("concat_path(%d, %d)\n", n, m);
#endif

    if (n == 0)
        return s;

    if (n == 1)
    {
        *s++ = 'E';
        *s++ = 'S';
        return s;
    }
    
    /* Find how many terms in f(n) = ... to skip. */
    int k = std::upper_bound(fsum[n], fsum[n] + n, m) - fsum[n];

    /* Now process f(n) = ... + g(n-k)*f(k) + ... */
    if (k > 0)
        m -= fsum[n][k-1];
    int q = m / f[k], r = m % f[k];
    *s++ = 'E';
    s = concat_path(s, n - k - 1, q);
    *s++ = 'S';
    s = concat_path(s, k, r);
    return s;
}

int main()
{
    /* Build f[] and fsum[] array. */
    f[0] = 1;
    for (int n = 1; n < MAX_N; n++)
    {
        int value = 0;
        for (int j = 0; j < n; j++)
            fsum[n][j] = (value += f[n-1-j] * f[j]);
        f[n] = value;
#if _DEBUG
        printf("f(%d) = %d\n", n, f[n]);
#endif
    }

    /* Process each input. */
    int n, m;
    while (scanf("%d %d", &n, &m) == 2 && n > 0)
    {
        --n;    /* n = distance between (1,1) and (n,n) */
        --m;    /* change index to zero-based */
        if (m >= f[n])
        {
            printf("ERROR\n");
        }
        else
        {
            char path[50];
            *concat_path(path, n, m) = '\0';
            printf("%s\n", path);
        }
    }
    return 0;
}
